﻿<phone:PhoneApplicationPage
    x:Name="phoneApplicationPagememoFullView"
    x:Class="GY.WP.PostMemo.Views.MemoFullView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    xmlns:c4fControls="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:vm="clr-namespace:GY.WP.PostMemo.ViewModels"
    Style="{StaticResource TransitionPageStyle}"
    toolkit:TiltEffect.IsTiltEnabled="True"
    >

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot Title="{Binding Path=AppName, Source={StaticResource LocalizedStrings}}">

            <controls:PivotItem Header="{Binding Path=PivotItemHeader_Todo, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <ListBox x:Name="listBoxMemoListTodo"
                             VerticalAlignment="Stretch"
                             ItemsSource="{Binding MemoListTodo}"
                             >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <c4fControls:ChatBubble Margin="10,0,10,20"
                                                        Name="chatBubbleDisplayMemo"
                                                        Width="440"
                                                        ChatBubbleDirection="LowerRight"
                                                        Background="{Binding DataContext.MemoListTodoBackground, ElementName=phoneApplicationPagememoFullView}"
                                                        >
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu>
                                            <toolkit:MenuItem Name="menuItemCopy"
                                                              Header="{Binding Path=MenuItem_Copy, Source={StaticResource LocalizedStrings}}"
                                                              Tap="menuItemCopy_Tap"
                                                              CommandParameter="{Binding}"/>
                                            <toolkit:MenuItem Name="menuItemDone"
                                                              Header="{Binding Path=MenuItem_Done, Source={StaticResource LocalizedStrings}}"
                                                              Tap="menuItemDone_Tap"
                                                              CommandParameter="{Binding}"/>
                                            <toolkit:MenuItem Name="menuItemDelete"
                                                              Header="{Binding Path=MenuItem_Delete, Source={StaticResource LocalizedStrings}}"
                                                              Tap="menuItemDelete_Tap"
                                                              CommandParameter="{Binding}"/>
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                    <StackPanel>
                                        <TextBlock Text="{Binding MemoContent}"
                                                   Name="textBlockContent"
                                                   Foreground="LightYellow"
                                                   TextWrapping="Wrap"/>
                                        <TextBlock Text="{Binding MemoDateTime, Converter={StaticResource DateTimeToStringConverter}}"
                                                   FontSize="16"
                                                   TextAlignment="Right"
                                                   HorizontalAlignment="Right"
                                                   Foreground="LightYellow"
                                                   Width="440"/>
                                    </StackPanel>
                                </c4fControls:ChatBubble>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>

            <controls:PivotItem Header="{Binding Path=PivotItemHeader_Done, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <ListBox x:Name="listBoxMemoListDone"
                             VerticalAlignment="Stretch"
                             ItemsSource="{Binding MemoListDone}"
                             >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <c4fControls:ChatBubble Margin="10,0,10,20"
                                                        Name="chatBubbleDisplayMemo"
                                                        Width="440"
                                                        ChatBubbleDirection="LowerRight"
                                                        Background="{Binding DataContext.MemoListDoneBackground, ElementName=phoneApplicationPagememoFullView}"
                                                        >
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu>
                                            <toolkit:MenuItem Name="menuItemCopy"
                                                              Header="{Binding Path=MenuItem_Copy, Source={StaticResource LocalizedStrings}}"
                                                              Tap="menuItemCopy_Tap"
                                                              CommandParameter="{Binding}"/>
                                            <toolkit:MenuItem Name="menuItemDelete"
                                                      Header="{Binding Path=MenuItem_Delete, Source={StaticResource LocalizedStrings}}"
                                                              Tap="menuItemDelete_Tap"
                                                              CommandParameter="{Binding}"/>
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                    <StackPanel>
                                        <TextBlock Text="{Binding MemoContent}"
                                                   Name="textBlockContent"
                                                   Foreground="LightYellow"
                                                   TextWrapping="Wrap"/>
                                        <TextBlock Text="{Binding MemoDateTime, Converter={StaticResource DateTimeToStringConverter}}"
                                                   FontSize="16"
                                                   TextAlignment="Right"
                                                   HorizontalAlignment="Right"
                                                   Foreground="LightYellow"
                                                   Width="440"/>
                                    </StackPanel>
                                </c4fControls:ChatBubble>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>

            <controls:PivotItem Header="{Binding Path=PivotItemHeader_All, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <ListBox ItemsSource="{Binding MemoGroupListAll}">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                            </Style>
                        </ListBox.ItemContainerStyle>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <toolkit:ExpanderView ItemsSource="{Binding MemoGroupList}"
                                                      Header="{Binding}"
                                                      Expander="{Binding}"
                                                      Margin="0,0,0,20"
                                                      >
                                    <toolkit:ExpanderView.HeaderTemplate>
                                        <DataTemplate>
                                            <Grid Margin="0,0,0,12"
                                                  Width="440"
                                                  Background="{Binding DataContext.MemoListAllBackground, ElementName=phoneApplicationPagememoFullView}"
                                                  >
                                                <TextBlock Text="{Binding MemoGroupTitleDate, Converter={StaticResource DateToStringConverter}}"
                                                           Margin="12,4,0,4"
                                                           Foreground="{StaticResource PhoneForegroundBrush}"
                                                           FontSize="{StaticResource PhoneFontSizeLarge}"
                                                           FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>
                                            </Grid>
                                        </DataTemplate>
                                    </toolkit:ExpanderView.HeaderTemplate>

                                    <toolkit:ExpanderView.ExpanderTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding MemoCount, Converter={StaticResource CountToStringConverter}}"
                                                       FontSize="{StaticResource PhoneFontSizeNormal}"
                                                       FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                                       Margin="0,0,0,0"
                                                       TextWrapping="Wrap"/>
                                        </DataTemplate>
                                    </toolkit:ExpanderView.ExpanderTemplate>

                                    <toolkit:ExpanderView.ItemTemplate>
                                        <DataTemplate>
                                            <ListBoxItem>
                                                <c4fControls:ChatBubble Margin="0,20,18,0"
                                                                        Name="chatBubbleDisplayMemo"
                                                                        ChatBubbleDirection="LowerRight"
                                                                        Background="{Binding DataContext.MemoListAllBackground, ElementName=phoneApplicationPagememoFullView}"
                                                                        >
                                                    <toolkit:ContextMenuService.ContextMenu>
                                                        <toolkit:ContextMenu>
                                                            <toolkit:MenuItem Name="menuItemCopy"
                                                                              Header="{Binding Path=MenuItem_Copy, Source={StaticResource LocalizedStrings}}"
                                                                              Tap="menuItemCopy_Tap"
                                                                              CommandParameter="{Binding}"/>
                                                            <toolkit:MenuItem Name="menuItemDelete"
                                                                              Header="{Binding Path=MenuItem_Delete, Source={StaticResource LocalizedStrings}}"
                                                                              Tap="menuItemDelete_Tap"
                                                                              CommandParameter="{Binding}"/>
                                                        </toolkit:ContextMenu>
                                                    </toolkit:ContextMenuService.ContextMenu>
                                                    <StackPanel>
                                                        <TextBlock Text="{Binding MemoContent}"
                                                                   Name="textBlockContent"
                                                                   Foreground="LightYellow"
                                                                   TextWrapping="Wrap"/>
                                                        <TextBlock Text="{Binding MemoDateTime, Converter={StaticResource DateTimeToStringConverter}}"
                                                                   FontSize="16"
                                                                   TextAlignment="Right"
                                                                   HorizontalAlignment="Right"
                                                                   Foreground="LightYellow"
                                                                   Width="440"/>
                                                    </StackPanel>
                                                </c4fControls:ChatBubble>
                                            </ListBoxItem>
                                        </DataTemplate>
                                    </toolkit:ExpanderView.ItemTemplate>
                                </toolkit:ExpanderView>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>

        </controls:Pivot>
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>